<template>
  <div class="my">
    <div class="top">
      <div class="top1">
        <div class="top1-left">
          <div class="top1-name">{{ userInfo.nickname }}</div>
          <div class="top1-txt">{{ userInfo.intro }}</div>
        </div>
        <img
          class="top1-right"
          v-if="userInfo.avatar"
          :src="baseUrl + userInfo.avatar"
          alt=""
          @click="getInfo"
        />
        <img
          class="top1-right"
          @click="getInfo"
          v-else
          src="@/assets/logo.png"
          alt=""
        />
      </div>
      <ul class="top2">
        <li>
          <div class="top2-num">298</div>
          <div class="top2-txt">累计答题</div>
        </li>
        <li>
          <div class="top2-num">298</div>
          <div class="top2-txt">累计答题</div>
        </li>
        <li>
          <div class="top2-num">298</div>
          <div class="top2-txt">累计答题</div>
        </li>
        <li>
          <div class="top2-num">298</div>
          <div class="top2-txt">累计答题</div>
        </li>
      </ul>
      <div class="top3">
        <my-cell
          class="cell"
          title="我的岗位"
          :value="userInfo.position"
          icon="&#xe64d;"
          @click="goEditInfo('position')"
        ></my-cell>
      </div>
    </div>
    <div class="middle">
      <div class="middle-content">
        <h3 class="middle-title">面经数据</h3>
        <ul class="middle-data">
          <li class="middle-item">
            <div class="item1">昨日阅读<span>+300</span></div>
            <div class="item2">17</div>
            <div class="item3">阅读总数</div>
          </li>
          <li class="middle-item">
            <div class="item1">昨日阅读<span>+300</span></div>
            <div class="item2">17</div>
            <div class="item3">阅读总数</div>
          </li>
          <li class="middle-item">
            <div class="item1">昨日阅读<span>+300</span></div>
            <div class="item2">17</div>
            <div class="item3">阅读总数</div>
          </li>
        </ul>
      </div>
      <div class="bottom">
        <my-cell title="我的岗位111" value="产品经理" icon="&#xe64d;"></my-cell>
        <my-cell title="我的岗位111" value="产品经理" icon="&#xe64d;"></my-cell>
        <my-cell title="我的岗位111" value="产品经理" icon="&#xe64d;"></my-cell>
        <my-cell title="我的岗位111" value="产品经理" icon="&#xe64d;"></my-cell>
        <my-cell title="我的岗位111" value="产品经理" icon="&#xe64d;"></my-cell>
        <my-cell title="我的岗位111" value="产品经理" icon="&#xe64d;"></my-cell>
      </div>
    </div>
  </div>
</template>

<script>
import myCell from './myCell'
import { mapState } from 'vuex'
// import { auInfo } from '@/api/my.js'
// import { getLocal } from '@/utils/local.js'
export default {
  components: {
    myCell
  },
  data () {
    return {
      baseUrl: process.env.VUE_APP_URL
    }
  },
  computed: {
    ...mapState(['userInfo', 'isLogin'])
  },
  methods: {
    getInfo () {
      this.$router.push('/home/myInfo')
    },
    goEditInfo (type) {
      this.$router.push('/home/editInfo?type=' + type)
    }
  },
  mounted () {
    document.body.style.backgroundColor = ' #f7f4f5'
  },
  beforeDestroy () {
    document.body.style.backgroundColor = ' #ffffff'
  }
}
</script>

<style lang="less" scoped>
.my {
  .top {
    background: linear-gradient(45deg, #ce0031, #b8002c);
    padding: 0 @p15;
    position: relative;
    .top1 {
      display: flex;
      justify-content: space-between;
      padding: 31px 0 29px;
      .top1-left {
        .top1-name {
          font-size: 21px;
          font-family: PingFangSC, PingFangSC-Semibold;
          font-weight: 600;
          text-align: left;
          color: #ffffff;
          line-height: 30px;
          letter-spacing: 0px;
        }
        .top1-txt {
          opacity: 0.7;
          font-size: 12px;
          font-family: PingFangSC, PingFangSC-Regular;
          font-weight: 400;
          text-align: left;
          color: #ffffff;
          line-height: 16px;
          letter-spacing: 0px;
        }
      }
      .top1-right {
        width: 50px;
        height: 50px;
        border: 3px solid rgba(255, 255, 255, 0.38);
        border-radius: 50%;
      }
    }
    .top2 {
      display: flex;
      padding-bottom: 55px;
      justify-content: space-between;
      align-items: center;
      text-align: center;
      .top2-num {
        font-size: 21px;
        font-family: DINAlternate, DINAlternate-Bold;
        font-weight: 700;
        text-align: center;
        color: #ffffff;
        line-height: 24px;
        letter-spacing: 0px;
      }
      .top2-txt {
        opacity: 0.7;
        font-size: 12px;
        font-family: PingFangSC, PingFangSC-Regular;
        font-weight: 400;
        text-align: center;
        color: #ffffff;
        line-height: 16px;
        letter-spacing: 0px;
      }
    }
    .top3 {
      width: 100%;
      position: absolute;
      bottom: -14px;
      left: 0;
      padding: 0 @p15;
      .cell {
        border-radius: 8px;
      }
    }
  }
  .middle {
    background-color: #f7f4f5;
    padding: 26px @p15 0;
    .middle-content {
      border-radius: 8px;
      background-color: #fff;
      padding: 19px 15px 15px;
      .middle-title {
        padding-bottom: 17px;
        font-size: 14px;
        font-family: PingFangSC, PingFangSC-Semibold;
        font-weight: 600;
        text-align: left;
        color: #181a39;
        line-height: 20px;
        letter-spacing: 0px;
      }
      .middle-data {
        display: flex;
        justify-content: space-between;
        .middle-item {
          .item1 {
            font-size: 12px;
            font-family: PingFangSC, PingFangSC-Regular;
            font-weight: 400;
            text-align: center;
            color: #b4b4bd;
            line-height: 14px;
            letter-spacing: 0px;
            span {
              color: #00b8d4;
            }
          }
          .item2 {
            padding: 10px 0;
            font-size: 21px;
            font-family: DINAlternate, DINAlternate-Bold;
            font-weight: 700;
            text-align: center;
            color: #181a39;
            line-height: 24px;
            letter-spacing: 0px;
          }
          .item3 {
            font-size: 12px;
            font-family: PingFangSC, PingFangSC-Regular;
            font-weight: 400;
            text-align: center;
            color: #545671;
            line-height: 16px;
            letter-spacing: 0px;
          }
        }
      }
    }
    .bottom {
      margin-top: 10px;
      border-radius: 8px;
    }
  }
}
</style>
